<?php

namespace app\superadmin\controller;
use app\common\controller\SuperadminBase;

use think\Controller;

use think\Db;

use think\Request;

use think\Session;



class Set extends SuperadminBase

{

    public function index()

    {
        if(\request()->isPost()){

            $data     = input('post.'); 
            //halt($data);

            $data1 = [];

            $data1['shigu'] = $data['shigu'];
            $data1['shuipao'] = $data['shuipao'];
            $data1['huoshao'] = $data['huoshao'];
            unset($data['shigu']);
            unset($data['shuipao']);
            unset($data['huoshao']);

            Db::table('yup_set')->where('id',1)->update($data);

            Db::table('yup_text')->where('id',1)->update($data1);
            
            return 1;

        }else{

            $id  = 1;

            $info = Db::table('yup_set')->where('id',$id)->find();

            $info1 = Db::table('yup_text')->where('id',$id)->find();

            $this->assign('info', $info);
            $this->assign('info1', $info1);

            return $this->fetch();

        }
        

    }



}

